*USING STATA MP 16

* TABLE 1 -- MAIN MODELS UNCONDITIONAL
*no controls
eststo reg1: reg controlling_change leaderturnover i.year, robust cluster(firm_iso3n_id)
*country controls 
eststo reg2: reg controlling_change leaderturnover polity2 icrg lngdp lngdpcap i.year , robust cluster(firm_iso3n_id) 
*country controls and country FE
eststo reg3: areg controlling_change leaderturnover polity2 icrg lngdp lngdpcap i.year , robust cluster(firm_iso3n_id) abs(iso3n)
*firm controls
eststo reg4: reg controlling_change leaderturnover logOpRev logEmployees i.year i.NACE2d, robust cluster(firm_iso3n_id) 
*all controls
eststo reg5: areg controlling_change leaderturnover polity2 icrg lngdp lngdpcap logOpRev logEmployees i.year i.NACE2d, robust cluster(firm_iso3n_id) abs(iso3n) 

		estout reg1 reg2 reg3 reg4 reg5, cells(b(star fmt(a2)) ///
		  se(par fmt(%4.3f))) starlevels( * .1 ** .05 *** .01) stats(N, fmt(%9.0gc)  labels("Number Obs."))  ///
		  nolz style(tex) drop(*year  *NACE2d )   ///
		  varlabels(leaderturnover "New political leader" ///
		  polity2 "Polity" icrg_qog "ICRG governance" ///
		  logOpRev "Log Operating revenue" logEmployees "Log employees" ///
		  lngdpcap "GDP per capita" lngdp "Log GDP" ///
		  _cons "Constant")

		  
* TABLE 2 -- mechanism  
	eststo reg1: ivregress 2sls controlling_change (leaderturnover = exelec) polity2 icrg lngdp lngdpcap i.year if system == 0, robust cluster(firm_iso3n_id) 
	weakivtest
	eststo reg2: ivregress 2sls controlling_change (leaderturnover = exelec) icrg polity2 lngdp lngdpcap logOpRev logEmployees i.year i.iso3n i.NACE2d if system == 0, robust cluster(firm_iso3n_id) 
	weakivtest
	eststo reg3: reg management_change leaderturnover polity2 icrg lngdp lngdpcap  i.year, robust cluster(firm_iso3n_id)
	eststo reg4: reg management_change leaderturnover polity2 icrg lngdp lngdpcap logOpRev logEmployees i.iso3n i.NACE2d i.year, robust cluster(firm_iso3n_id) 

	estout reg1 reg2 reg3 reg4, extracols(3) cells(b(star fmt(a2)) ///
		  se(par fmt(%4.3f))) starlevels( * .1 ** .05 *** .01) stats(N, fmt(%9.0gc)  labels("Number Obs." ))  ///
		  nolz style(tex) drop(*year *iso3n *NACE2d )   ///
		  order(leaderturnover ) ///
		  varlabels(leaderturnover "New political leader" ///
		  polity2 "Polity" icrg_qog "ICRG governance" ///
		  logOpRev "Log Operating revenue" logEmployees "Log employees" ///
		  lngdpcap "GDP per capita" lngdp "Log GDP" ///
		  _cons "Constant")
	

* TABLE 3: INTERACTIONS  
* LINEAR REGRESSIONS 
gen mo_unknown = 1 - mo_last_name

	eststo reg1: reg controlling_change c.leaderturnover##i.mo_unknown polity2 icrg lngdp lngdpcap i.year, robust cluster(firm_iso3n_id) 
	eststo reg2: areg controlling_change c.leaderturnover##i.mo_unknown polity2 icrg lngdp lngdpcap logOpRev logEmployees i.year i.NACE2d, robust cluster(firm_iso3n_id) abs(iso3n) 
	
 	eststo reg3: reg controlling_change c.leaderturnover##c.wbgi_rle polity2  lngdp lngdpcap i.year, robust cluster(firm_iso3n_id) 
	eststo reg4: areg controlling_change c.leaderturnover##c.wbgi_rle polity2 lngdp lngdpcap logOpRev logEmployees i.year i.NACE2d, robust cluster(firm_iso3n_id) abs(iso3n) 	
	
  	eststo reg5: reg controlling_change c.leaderturnover##c.FixedShare polity2 icrg lngdp lngdpcap i.year, robust cluster(firm_iso3n_id)
	eststo reg6: areg controlling_change c.leaderturnover##c.FixedShare polity2 icrg lngdp lngdpcap logOpRev logEmployees i.year i.NACE2d, robust cluster(firm_iso3n_id) abs(iso3n) 
	
		estout reg1 reg2 reg3 reg4 reg5 reg6, extracols(3 5) cells(b(star fmt(a2)) ///
		  se(par fmt(%4.3f))) starlevels( * .1 ** .05 *** .01) stats(N, fmt(%9.0gc)  labels("Number Obs." ))  ///
		  nolz style(tex) drop(*year  *NACE2d 0.* *0* )   ///
		  order(leaderturnover c.leaderturnover#1.mo_unknown c.leaderturnover#c.wbgi_rle c.leaderturnover#c.FixedShare)  ///
		  varlabels(leaderturnover "New political leader" ///
		  1.mo_unknown#c.leaderturnover " \ \ x unknown owner" c.leaderturnover#c.wbgi_rle " \ \ x rule of law" c.leaderturnover#c.FixedShare " \ \ x fixed assets" ///
		  polity2 "Polity" icrg_qog "ICRG governance" ///
		  1.mo_unknown "Unknown owner" wbgi_rle "Rule of law" FixedShare "Fixed assets" ///
		  logOpRev "Log Operating revenue" logEmployees "Log employees" ///
		  lngdpcap "GDP per capita" lngdp "Log GDP" ///
		  _cons "Constant")
		  		 
		
* TABLE 4 -- TAXES AND PROFITS 

	eststo reg1: reg  f.logprofit connected_owner  polity2 icrg lngdp lngdpcap i.year , robust cluster(firm_iso3n_id) 
	eststo reg2: areg f.logprofit connected_owner  polity2 icrg lngdp lngdpcap logOpRev logEmployees i.year i.NACE2d  , robust cluster(firm_iso3n_id) abs(iso3n)  

	eststo reg3: reg  f.logTaxShare connected_owner  polity2 icrg lngdp lngdpcap i.year  , robust cluster(firm_iso3n_id) 
	eststo reg4: areg f.logTaxShare connected_owner  polity2 icrg lngdp lngdpcap logOpRev logEmployees i.year i.NACE2d  , robust cluster(firm_iso3n_id) abs(iso3n)  
	
		estout reg1 reg2 reg3 reg4 , extracols(3) cells(b(star fmt(a2)) ///
		  se(par fmt(%4.3f))) starlevels( * .1 ** .05 *** .01) stats(N, fmt(%9.0gc)  labels("Number Obs." ))  ///
		  nolz style(tex) drop(*year  *NACE2d )   ///
		  varlabels(connected_owner "Connected owner" ///
		  polity2 "Polity" icrg_qog "ICRG governance" ///
		  logOpRev "Log Operating revenue" logEmployees "Log employees" ///
		  lngdpcap "GDP per capita" lngdp "Log GDP" ///
		  _cons "Constant")
		  


